import os
import threading
from multiprocessing import Process

import _tkinter

from FileHandlers.JsonFile import JReadConfig, JWriteConfig, pip2Ui

from debug import Debug

VERSION = "3"
DEFA_STATE = [False, True, False]
DEFA_VALUE = ["跟随图片-强制开启", "声音", "R18音效"]


class PluginLoader:
    @staticmethod
    def GetConfig():
        try:
            return JReadConfig(f"plugin{VERSION}")
        except FileNotFoundError as e:  # 还没有新建
            Debug.CustomLogger().log(f"无配置模式: {e}", Debug.DebugType.ZAYU)
            JWriteConfig(f"plugin{VERSION}", DEFA_STATE)
            return DEFA_STATE

    @staticmethod
    def openUI():
        return PluginLoader.GetConfig()[0]

    @staticmethod
    def LOADER():
        os.system("title 奴隶岛")
        # t = threading.Thread(target=lambda: os.system("python ./plugin/goodUi/main.py"))
        # t.daemon = True
        # t.start()



